/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
function photoFrame(selector, frameWidth, frameHeight) {
    $(selector).each(function(){
        var width = ($(this).width())*1;
        var height = ($(this).height())*1;

        if(height > width){
            $(this).width(frameWidth);
            var originHeight = ($(this).height())*1;
            var rangeMove = (originHeight - frameHeight)/2;
            $(this).css({"margin-top":"-"+rangeMove+"px"});
        }
        else {
            $(this).height(frameHeight);
            var originWidth = ($(this).width())*1;
            var rangeMove = (originWidth - frameWidth)/2;
            $(this).css({"margin-left":"-"+rangeMove+"px"});
        }
    });
}

